package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.WorkSpaceService;
import com.sky.vo.BusinessDataVO;
import com.sky.vo.DishOverViewVO;
import com.sky.vo.OrderOverViewVO;
import com.sky.vo.SetmealOverViewVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangyu
 * @data 2023/4/29 9:14
 */
@RestController
@RequestMapping("/admin/workspace")
@Api(tags = "商家操作工作台相关接口")
@Slf4j
public class WorkSpaceController {
    @Autowired
    private WorkSpaceService workSpaceService;

    @GetMapping("/businessData")
    @ApiOperation("商家查看今日相关数据接口")
    public Result<BusinessDataVO> selectBusinessData() {
        BusinessDataVO businessData = workSpaceService.getBusinessData();
        log.info("bus: {}", businessData);

        return Result.success(businessData);
    }

    @GetMapping("/overviewSetmeals")
    @ApiOperation("商家查看套餐总览")
    public Result<SetmealOverViewVO> selectSetMealStatus() {
        return Result.success(workSpaceService.getSetMealStatus());
    }

    @GetMapping("/overviewDishes")
    @ApiOperation("商家查看菜品总览")
    public Result<DishOverViewVO> getDishStatus() {
        return Result.success(workSpaceService.getDishStatus());
    }
    @GetMapping("/overviewOrders")
    @ApiOperation("商家工作台统计不同状态的订单接口")
    public Result<OrderOverViewVO> getOrderStatus(){
        return Result.success(workSpaceService.getOrderStatus());
    }
}
